#include "sharedPtr.hpp"
#include "string.hpp"


using Ptr::sharedPtr;
using my_string::String;

//void test()
//{
//	sharedPtr<int> ptr1(new int(10));
//	sharedPtr<int> ptr2 = ptr1;
//	sharedPtr<int> ptr3(ptr2);
//
//	std::cout << "use_count: " << ptr3.use_count() << std::endl;
//}

void test1()
{
	String s("hello");
	std::cout << "s: " << s.size() << "  str: " << s.c_str() << std::endl;
	String s1(s);
	s1.append("c++");
	std::cout << "s1: " << s1.size() << "  str: " << s1.c_str() << std::endl;
	
	for (int i = 0; i < 24; i++)
	{
		s1.push_back('a' + i);
	}
	std::cout << "s1: " << s1.size() << "  str: " << s1.c_str() << std::endl;

	s1.resize(s1.size() - 24);
	std::cout << "s1: " << s1.size() << "  str: " << s1.c_str() << std::endl;


	String s2 = s1;
	String s3 = "hello";
	String s4 = std::move(s3);
	String s5(std::move(s4));

	s5 = s2;
}

int main()
{
	//test();
	test1();
	return 0;
}